package com.zhang.network.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhang.network.mapper.UserMapper;
import com.zhang.network.model.Recommend;
import com.zhang.network.mapper.RecommendMapper;
import com.zhang.network.model.recommend.RecommendDTO;
import com.zhang.network.model.recommend.RecommendVO;
import com.zhang.network.service.RecommendService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhang
 * @since 2021-04-03
 */
@Service
public class RecommendServiceImpl extends ServiceImpl<RecommendMapper, Recommend> implements RecommendService {


    @Resource
    UserMapper userMapper;

    // 数据库加推荐人昵称
    @Override
    public Page<RecommendVO> pageRecommend(RecommendDTO recommendDTO) {
        Page<RecommendVO> page = new Page<>(recommendDTO.getPageNum(), recommendDTO.getPageSize());
        return userMapper.recommendList(page, recommendDTO.getUserId());
    }

    @Override
    public Page<RecommendVO> pageFriendRequest(RecommendDTO recommendDTO) {
        Page<RecommendVO> page = new Page<>(recommendDTO.getPageNum(), recommendDTO.getPageSize());
        return userMapper.friendRequestList(page, recommendDTO.getUserId());
    }


}
